package cc.momas.mybatis.multidatasource.kingseok;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.CommandLineRunner;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 * @author Sod-Momas
 * @since 2019.11.04
 **/
public class TestKingseokClass implements CommandLineRunner {

    @Autowired
    private DataSource dataSource;

    @Override
    public void run(String... args) throws Exception {
        System.out.println("kingseok ==== start");
////        System.out.println(dataSource);
//        Connection connection = dataSource.getConnection();
//        PreparedStatement ps = connection.prepareStatement("select id,machine_name,create_time from activelog;");
//        ResultSet rs = ps.executeQuery();
//        if (rs.next()) {
//            System.out.println(rs.getInt("id"));
//            System.out.println(rs.getString("machine_name"));
//            System.out.println(rs.getDate("create_time").toLocalDate());
//        }
//        rs.close();
//        ps.close();
//        connection.close();
        System.out.println("kingseok ==== end");
    }
}
